package com.longcai.mapper.nearbyshop;

import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.longcai.entity.nearby.ClyjNearbyShopsGoods;

/**
 * <p>
 * 附近-商铺商品 Mapper 接口
 * </p>
 *
 * @author kh
 * @since 2019-04-25
 */
public interface ClyjNearbyShopsGoodsMapper extends BaseMapper<ClyjNearbyShopsGoods> {

	 /**下架单个**/
	 @Update("update clyj_nearby_shops_goods set status ='1' where goods_id=#{goodsId}")
	 int pullOffShelvesBatch(@Param("goodsId")String goodsId);
	 
	 /**批量下架**/
	 int updatePullOffShelvesBatch(List<Map<String, String>>  list);
	 
	 /**批量删除**/
	int updateDeleteNearbyShopsGoods(List<Map<String, String>>  list);
	
	
	/**
	 * 查询销售中数量
	 * **/
    @Select("select count(*)  from clyj_nearby_shops_goods  c  where c.status=0 and c.auditing_status=0 and c.delete_flg=1;")
    int querySaleIngCount();
    /**
	 * 查询未审核的数量
	 * **/
    @Select("select count(*)  from clyj_nearby_shops_goods  c  where  c.auditing_status=1 and c.delete_flg=1;")
    int querynotAuditing();
  
    /**
	 * 查询回收站
	 * **/
    @Select("select count(*)  from clyj_nearby_shops_goods  c  where  c.delete_flg=0;")
    int queryDeleteCount();
    
    
    /**
	 * 库存低于库存警告的列表
	 * **/
    @Select("select * from clyj_nearby_shops_goods  c  where c.stock < c.stock_warn")
    List<ClyjNearbyShopsGoods> compareStock();
    
    /**
	 * 仓库中类表
	 * **/
    @Select("select * from clyj_nearby_shops_goods  c  where c.stock = 0 ")
    List<ClyjNearbyShopsGoods> queryStock();
    /**上架单个**/
	 @Update("update clyj_nearby_shops_goods set status ='0' where goods_id=#{goodsId}")
	int putOnsale(String goodsId);
}
